package com.csci;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class IsingImage {
	BufferedImage bufferedImage;
	
	public void generateBufferedImage(int[][] matrix, int row, int col){
		 bufferedImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);	
		for(int i = 0; i < row; i++){
			for (int j = 0; j < col; j ++){
					if(matrix[i][j] == 1){
						bufferedImage.setRGB(i, j, Color.BLUE.getRGB());
					}
					else{
						bufferedImage.setRGB(i, j, Color.RED.getRGB());
					}
			}
		}
	}
	
	
	public void generateBitmap(File fileName,int[][] matrix, int row, int col){
		generateBufferedImage(matrix, row, col);
		try {
			ImageIO.write(bufferedImage, "bmp", fileName);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	
}
